//
//  HeziSDKWebView.h
//  FloatIconSDK
//
//  Created by ljcoder on 16/6/30.
//  Copyright © 2016年 ljcoder. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "HeziShareModel.h"
#define HeziSDKScreenWith [UIScreen mainScreen].bounds.size.width
#define HeziSDKScreenHeight [UIScreen mainScreen].bounds.size.height

typedef NS_ENUM(NSUInteger, HeziSDKWebViewType) {
    HeziSDKWebViewTypeFull,
    HeziSDKWebViewTypeHalf,
};

@class HeziSDKWebView;
@protocol HeziSDKWebViewLoadDelegate <NSObject>
@optional

/**
 外界可以在开始加载的时候重置分享的模型,例如设置为nil
 */
- (void)heziSDKWebViewStartLoad:(HeziSDKWebView *)heziWebView;
- (void)heziSDKWebViewFinishLoad:(HeziSDKWebView *)heziWebView;
- (void)heziSDKWebViewFailLoad:(HeziSDKWebView *)heziWebView WithError:(NSError *)error;

/**
 外界可以监听这个方法来获取,分享的模型.
 分享完整的模型都是是等网页加载完后生成的.
 @param model 分享的模型
 */
- (void)heziSDKWebView:(HeziSDKWebView *)heziWebView didCatchShareContent:(HeziShareModel *)model;
@end

@interface HeziSDKWebView : UIView


/**
 分享按钮(内置的)点击后,会触发该回调.
 
 假如没有获取到能分享的数据,内置的分享按钮是hidden状态
 */
@property (copy, nonatomic) void(^shareBlock)(HeziShareModel *shareContent);

/**
 内置关闭按钮会触发该回调
 */
@property (copy, nonatomic) void(^closeBlock)(void);

- (instancetype)initWithFrame:(CGRect)frame type:(HeziSDKWebViewType)type;

- (void)loadUrlString:(NSString *)urlString;

@property (strong, nonatomic, readonly) UIImageView *navigationBar;
@property (strong, nonatomic) UIColor *navigationColor;

//新增判断是否是 vewicontroller 过来的
@property (assign,nonatomic)BOOL isViewController;

//新增代理,被动获得分享的参数
@property (nonatomic,weak) id<HeziSDKWebViewLoadDelegate> webShareDelegate;


#pragma mark - 相关的控制方法
/*
 假如外界想自己实现自己的刷新,关闭等按钮,可以调用如下的方法进行相关的控制.
 分享功能的实现可以设置shareDelegate,进行监听分享参数.
 */
//刷新
-(void)outerHeziWebViewReflesh;

//关闭
-(void)outerHeziWebViewClose;

//后退
-(void)outerHeziWebViewGoBack;

//能否后退
-(BOOL)outerHeziWebViewCanGoBack;


@end
